This invention relates generally to object-oriented programming and more particularly to a method and system for load balancing in a distributed object system.
When large-scale distributed object systems are built, scalability and performance are major concerns. Scalability refers to the ability of a system to scale up to support a larger number of users, a larger workload, a larger number of transactions, and/or a larger number of services. In other words, scalability refers to the ability of a system to easily expand to perform more work. A system with good scalability allows one to introduce more resources as needed to scale the system to support the additional workload without making significant changes to the remainder of the system.
In typical distributed system environments, the load on the system changes, sometimes on a monthly basis and even on a daily basis. A flexible system should ideally make efficient use of all resources in the system to balance the load across the network and achieve high performance.
Software developers have begun considering the implementation of large distributed object systems. In such systems, it may be desirable for the systems manager to balance the workload of various computer processes across the network. Accordingly, a need has arisen for a scalable distributed object system that attains high performance by efficiently distributing the workload across a network.
The invention provides a method and system for load balancing in a distributed object system that facilitates the scalability and efficient performance of that system. One aspect of the invention is a method for load balancing in a distributed object system running on a network comprising a plurality of computers including a first computer wherein the computers are operable to access a plurality of shared objects in a distributed object system. The method comprises instructing an object comprising a part of an application process running on the first computer to record at least one performance statistic in response to a message directed to the object. The application process comprises a multi-threaded process including a statistics thread. The at least one performance statistic may be periodically obtained using the statistics thread and sent to a local agent process running on the first computer. The performance statistic is related to a workload service running on a second computer connected to the network. A new distributed object is instantiated in the memory of one of the plurality of computers based upon performance statistics maintained by the workload service.
The invention has several important technical advantages. By using a workload service to determine where new objects are instantiated, the invention allows efficient use of all computer resources in a distributed object system. The disclosed system is highly scalable. Because the invention takes into account the performance of the system in determining where to instantiate new objects, the system makes efficient use of resources to achieve higher throughput. The architecture of the system allows each business object (or application object) to maintain its own statistics, thus allowing the workload service and local agents to operate smoothly without regard to how many application processes are providing the workload service and local agent with statistics.